package com.cmwa.solution.business.investTrade.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cmwa.solution.base.entity.Page;
import com.cmwa.solution.base.entity.SearchParam;
import com.cmwa.solution.business.investTrade.dao.TradeStructureDao;
import com.cmwa.solution.business.investTrade.entity.AsseTradeRelVo;
import com.cmwa.solution.business.investTrade.entity.AsseUnitVo;
import com.cmwa.solution.business.investTrade.entity.TradeUnitVo;
import com.cmwa.solution.business.investTrade.service.TradeStructureService;

/**
 * 交易结构业务层接口实现
 * @author ex-chenbq
 *
 */
@Service
public class TradeStructureServiceImpl implements TradeStructureService{

	@Autowired
	private TradeStructureDao tradeStructureDao;
	
	@Override
	public Page<AsseUnitVo> queryAsseUnitListPage(SearchParam param) {
		List<AsseUnitVo> items = tradeStructureDao.queryAsseUnitListPage(param);
		return Page.create(items, param.getStart(), param.getLimit(), param.getTotal());
	}

	@Override
	public List<AsseUnitVo> queryAsseUnitList(SearchParam param) {
		List<AsseUnitVo> list = tradeStructureDao.queryAsseUnitList(param);
		return list;
	}

	@Override
	public void insertAsseUnit(AsseUnitVo asseUnitVo) {
		tradeStructureDao.insertAsseUnit(asseUnitVo);
	}

	@Override
	public Page<TradeUnitVo> queryTradeUnitListPage(SearchParam param) {
		List<TradeUnitVo> items = tradeStructureDao.queryTradeUnitListPage(param);
		return Page.create(items, param.getStart(), param.getLimit(), param.getTotal());
	}

	@Override
	public List<TradeUnitVo> queryTradeUnitList(SearchParam param) {
		List<TradeUnitVo> list = tradeStructureDao.queryTradeUnitList(param);
		return list;
	}

	@Override
	public void insertTradeUnit(TradeUnitVo tradeUnitVo) {
		tradeStructureDao.insertTradeUnit(tradeUnitVo);
	}

	@Override
	public void insertAsseAndTradeUnitRel(AsseTradeRelVo asseTradeRelVo) {
		tradeStructureDao.insertAsseAndTradeUnitRel(asseTradeRelVo);
	}

	@Override
	public List<AsseTradeRelVo> queryAsseAndTradeUnitRelById(String assetUnitId) {
		List<AsseTradeRelVo> list = tradeStructureDao.queryAsseAndTradeUnitRelById(assetUnitId);
		return list;
	}

	@Override
	public void deleteAsseAndTradeUnitRel(String assetUnitId) {
		tradeStructureDao.deleteAsseAndTradeUnitRel(assetUnitId);
	}

	@Override
	public AsseUnitVo queryAsseUnitById(String id) {
		AsseUnitVo vo = tradeStructureDao.queryAsseUnitById(id);
		return vo;
	}

	@Override
	public void updateAsseUnit(AsseUnitVo asseUnitVo) {
		tradeStructureDao.updateAsseUnit(asseUnitVo);
	}

	@Override
	public void deleteAsseUnit(String id) {
		tradeStructureDao.deleteAsseUnit(id);
	}
}
